home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995 August: Tool Chest / Dev.CD Aug 95 TC / Dev.CD Aug 95 TC.toast / Tool Chest / Interfaces / UniversalInterfaces 2.1B1 / AIncludes / TranslationExtensions.a < prev    next >
Encoding:
Text File  |  1995-04-18  |  5.4 KB  |  167 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        TranslationExtensions.a
  3. ;
  4. ;    Contains:    Macintosh Easy Open Translation Extension Interfaces.
  5. ;
  6. ;    Version:    Technology:    Macintosh Easy Open 1.1
  7. ;                Package:    Universal Interfaces 2.1ß1 in “MPW Prerelease” on ETO #17
  8. ;
  9. ;    Copyright:    © 1984-1995 by Apple Computer, Inc.
  10. ;                All rights reserved.
  11. ;
  12. ;    Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13. ;                stack.  Include the file and version information (from above)
  14. ;                in the problem description and send to:
  15. ;                    Internet:    apple.bugs@applelink.apple.com
  16. ;                    AppleLink:    APPLE.BUGS
  17. ;
  18. ;
  19.  
  20.     IF &TYPE('__TRANSLATIONEXTENSIONS__') = 'UNDEFINED' THEN
  21. __TRANSLATIONEXTENSIONS__ SET 1
  22.  
  23.  
  24.     IF &TYPE('__MEMORY__') = 'UNDEFINED' THEN
  25.     include 'Memory.a'
  26.     ENDIF
  27. ;        include 'Types.a'                                            ;
  28. ;            include 'ConditionalMacros.a'                            ;
  29. ;        include 'MixedMode.a'                                        ;
  30.  
  31.     IF &TYPE('__FILES__') = 'UNDEFINED' THEN
  32.     include 'Files.a'
  33.     ENDIF
  34. ;        include 'OSUtils.a'                                        ;
  35.  
  36.     IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
  37.     include 'Quickdraw.a'
  38.     ENDIF
  39. ;        include 'QuickdrawText.a'                                    ;
  40.  
  41.     IF &TYPE('__COMPONENTS__') = 'UNDEFINED' THEN
  42.     include 'Components.a'
  43.     ENDIF
  44.  
  45. kSupportsFileTranslation        EQU        1
  46. kSupportsScrapTranslation        EQU        2
  47. kTranslatorCanGenerateFilename    EQU        4
  48.  
  49. ; typedef OSType             FileType
  50. ; typedef ResType             ScrapType
  51. ; typedef unsigned long     TranslationAttributes
  52.  
  53. taDstDocNeedsResourceFork        EQU        1
  54. taDstIsAppTranslation            EQU        2
  55.  
  56. FileTypeSpec             RECORD    0
  57. format                     ds.l   1        ; offset: $0 (0)
  58. hint                     ds.l   1        ; offset: $4 (4)
  59. flags                     ds.l   1        ; offset: $8 (8)        ; taDstDocNeedsResourceFork, taDstIsAppTranslation
  60. catInfoType                 ds.l   1        ; offset: $C (12)
  61. catInfoCreator             ds.l   1        ; offset: $10 (16)
  62. sizeof                     EQU *            ; size:   $14 (20)
  63.                         ENDR
  64.  
  65. ; typedef struct FileTypeSpec  FileTypeSpec
  66. FileTranslationList     RECORD    0
  67. modDate                     ds.l   1        ; offset: $0 (0)
  68. groupCount                 ds.l   1        ; offset: $4 (4)
  69. ;     unsigned long    group1SrcCount;
  70. ;     unsigned long    group1SrcEntrySize = sizeof(FileTypeSpec);
  71. ;  FileTypeSpec    group1SrcTypes[group1SrcCount]
  72. ;  unsigned long    group1DstCount;
  73. ;  unsigned long    group1DstEntrySize = sizeof(FileTypeSpec);
  74. ;  FileTypeSpec    group1DstTypes[group1DstCount]
  75. sizeof                     EQU *            ; size:   $8 (8)
  76.                         ENDR
  77.  
  78. ; typedef struct FileTranslationList  FileTranslationList
  79. ; typedef FileTranslationList  *FileTranslationListPtr, **FileTranslationListHandle
  80. ScrapTypeSpec             RECORD    0
  81. format                     ds.l   1        ; offset: $0 (0)
  82. hint                     ds.l   1        ; offset: $4 (4)
  83. sizeof                     EQU *            ; size:   $8 (8)
  84.                         ENDR
  85.  
  86. ; typedef struct ScrapTypeSpec  ScrapTypeSpec
  87. ScrapTranslationList     RECORD    0
  88. modDate                     ds.l   1        ; offset: $0 (0)
  89. groupCount                 ds.l   1        ; offset: $4 (4)
  90. ;     unsigned long        group1SrcCount;
  91. ;     unsigned long        group1SrcEntrySize = sizeof(ScrapTypeSpec);
  92. ;  ScrapTypeSpec        group1SrcTypes[group1SrcCount]
  93. ;  unsigned long        group1DstCount;
  94. ;     unsigned long        group1DstEntrySize = sizeof(ScrapTypeSpec);
  95. ;  ScrapTypeSpec        group1DstTypes[group1DstCount]
  96. sizeof                     EQU *            ; size:   $8 (8)
  97.                         ENDR
  98.  
  99. ; typedef struct ScrapTranslationList  ScrapTranslationList
  100. ; typedef ScrapTranslationList  *ScrapTranslationListPtr, **ScrapTranslationListHandle
  101. ; definition of callbacks to update progress dialog
  102. ; typedef long                 TranslationRefNum
  103. ;****************************************************************************************
  104. ;*
  105. ;* This routine sets the advertisement in the top half of the progress dialog.
  106. ;* It is called once at the beginning of your DoTranslateFile routine.
  107. ;*
  108. ;* Enter:    refNum            Translation reference supplied to DoTranslateFile.
  109. ;*            advertisement    A handle to the picture to display.  This must be non-purgable.
  110. ;*                            Before returning from DoTranslateFile, you should dispose
  111. ;*                            of the memory.  (Normally, it is in the temp translation heap
  112. ;*                            so it is cleaned up for you.)
  113. ;*
  114. ;* Exit:    returns            noErr, paramErr, or memFullErr
  115. ;
  116. ;
  117. ; pascal OSErr SetTranslationAdvertisement(TranslationRefNum refNum, PicHandle advertisement)
  118. ;
  119.     IF ¬ GENERATINGCFM THEN
  120.         Macro
  121.         _SetTranslationAdvertisement
  122.             moveq    #2,d0
  123.             dc.w     $ABFC
  124.         EndM
  125.     ELSE
  126.         IMPORT_CFM_FUNCTION    SetTranslationAdvertisement
  127.     ENDIF
  128.  
  129. ;****************************************************************************************
  130. ;*
  131. ;* This routine updates the progress bar in the progress dialog.
  132. ;* It is called repeatedly from within your DoTranslateFile routine.
  133. ;* It should be called often, so that the user will get feedback if he tries to cancel.
  134. ;*
  135. ;* Enter:    refNum        translation reference supplied to DoTranslateFile.
  136. ;*            progress    percent complete (0-100)
  137. ;*
  138. ;* Exit:        canceled    TRUE if the user clicked the Cancel button, FALSE otherwise
  139. ;*            returns        noErr, paramErr, or memFullErr
  140. ;
  141. ;
  142. ; pascal OSErr UpdateTranslationProgress(TranslationRefNum refNum, short percentDone, Boolean *canceled)
  143. ;
  144.     IF ¬ GENERATINGCFM THEN
  145.         Macro
  146.         _UpdateTranslationProgress
  147.             moveq    #1,d0
  148.             dc.w     $ABFC
  149.         EndM
  150.     ELSE
  151.         IMPORT_CFM_FUNCTION    UpdateTranslationProgress
  152.     ENDIF
  153.  
  154. ; ComponentMgr selectors for routines
  155.  
  156. kTranslateGetFileTranslationList EQU        0                    ; component selectors
  157. kTranslateIdentifyFile            EQU        1
  158. kTranslateTranslateFile            EQU        2
  159. kTranslateGetTranslatedFilename    EQU        3
  160. kTranslateGetScrapTranslationList EQU        10                ; skip to scrap routines
  161. kTranslateIdentifyScrap            EQU        11
  162. kTranslateTranslateScrap        EQU        12
  163.  
  164. ; Routines to implment in a file translation extension
  165. ; Routine to implement in a scrap translation extension
  166.     ENDIF ; __TRANSLATIONEXTENSIONS__
  167.